<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>比较最大值</title>
</head>
<body>
<script>
    function getMax(n1, n2) {
        var max = n1 > n2 ? n1 : n2;
        return max;
    }

    var result1 = getMax(6.98, 6.99);
    alert("两个数中的最大值为：" + result1);


    function getMax1(a, b, c) {

        var max = a > b ? (a > c ? a : c) : (b > c ? b : c);
        return max;
    }

    var result2 = getMax1(40, 70, 10);
    alert("三个数中的最大值为：" + result2);
</script>
</body>
</html>